package com.sky.config;
import com.sky.properties.MinioProperties;
import com.sky.utils.MinioUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Slf4j
@Configuration
public class MinioConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public MinioUtil MinioUtil(MinioProperties minioProperties) {
        log.info("创建Minio工具对象");
        return new MinioUtil(
                minioProperties.getEndpoint(),
                minioProperties.getAccessKeyId(),
                minioProperties.getAccessKeySecret(),
                minioProperties.getBucketName()
        );

    }
}

